package socket;

import java.io.InputStream;
import java.net.Socket;

/**
 * @author mjy
 * @date 2021/12/23
 * @description
 */
public class MyscoketClent {

    public static void main(String[ ] args) throws Exception {
        Socket socket = new Socket("127.0.0.1", 5569);
        socket.getOutputStream().write("客户端发送给服务端测试数据".getBytes());
        byte[] data = new byte[1024];
        InputStream in = socket.getInputStream();
        int length = in.read(data);
        String s = new String(data, 0, length);
        System.out.println(s);
    }
}
